﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using InfoLayer;
using DataAccessLayer;
using ControlLayer;
namespace GUI
{
    public partial class frmTraCuuCauThu : Form
    {
        private bool hien_trang;
        private enum TableTraCuu { STT = 0, CauThu = 1, Doi = 2, LoaiCauThu = 3, TongBanThang = 4 }
        
        public frmTraCuuCauThu()
        {
            InitializeComponent();
            hien_trang = true;
            comboBox_MucTraCuu.SelectedIndex = 0;
        }

        private void frmTraCuuCauThu_Load(object sender, EventArgs e)
        {

        }
        private void textBox_TraCuu_TextChanged(object sender, EventArgs e)
        {
            //Xóa dữ liệu tra cứu cũ
            if (dataGridView_TraCuu.RowCount != 1)
            {
                while (dataGridView_TraCuu.RowCount > 1) 
                {
                    dataGridView_TraCuu.Rows.RemoveAt(0);
                }
            }
            //try
            //{
            //    List<Data> table = CauThuDataAccess.TraCuu(textBox_TraCuu.Text, comboBox_MucTraCuu.SelectedIndex);

            //    for (int i = 0; i < table.Count; i++)
            //    {
            //        DataGridViewRow row = new DataGridViewRow();
            //        row.Cells.Add(XuLyDataDridView.CreateCell(""));
                    
            //        for (int j = 0; j < table[i].Count; j++)
            //        {
            //            row.Cells.Add(XuLyDataDridView.CreateCell(table[i].GetData[j].ToString()));
            //        }

            //        dataGridView_TraCuu.Rows.Add(row);
            //    }
            //}
            //catch
            //{
            //    MessageBox.Show("Lỗi hệ thống tra cứu", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
            
        }
        private void comboBox_MucTraCuu_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        private void textBox_TraCuu_Click(object sender, MouseEventArgs e)
        {
            textBox_TraCuu.Clear();
        }

        private void Exit_Click(object sender, EventArgs e)
        {
            hien_trang = false;
            this.Close();
        }

        
    }
}
